import java.util.*;


public class Answer3 {
    //点击消除
    //https://www.nowcoder.com/practice/8d3643ec29654cf8908b5cf3a0479fd5?tpId=308&tqId=40462&ru=/exam/oj
    public static void main(String[] args){
        Scanner in =new Scanner (System.in);
        char[] ch=in.next().toCharArray();

        // 用来存储
        StringBuilder st=new StringBuilder();
        for(int i=0;i<ch.length;i++){
            char x=ch[i];
            if(st.length() != 0 && x == st.charAt(st.length()-1)){
                // 出战
                st.deleteCharAt(st.length()-1);
            }else{
                // 入栈
                st.append(x);
            }
        }

        System.out.println(st.length() == 0 ? 0 : st.toString());
    }
}
